package com.xmb.wechat.view.alipay;

import android.text.TextUtils;
import android.widget.EditText;

import com.xmb.wechat.R;
import com.xmb.wechat.R2;
import com.xmb.wechat.base.BaseActivity;
import com.xmb.wechat.definterface.HintListener;
import com.xmb.wechat.util.MoneyFormat;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @Author lijiangop
 * @CreateTime 2020/5/21 09:27
 */
public class AliPayBalanceActivity extends BaseActivity {

    @BindView(R2.id.et_balance)
    EditText mEtBalance;

    public AliPayBalanceActivity() {
        super(R.layout.activity_alipay_balance);
    }

    @Override
    protected void initView() {
        showExemption(new HintListener() {
            @Override
            public void onConfirm() {
                //do nothing
            }

            @Override
            public void onCancel() {
                AliPayBalanceActivity.this.finish();
            }
        });
    }

    @OnClick(R2.id.btn_preview)
    public void onViewClicked() {
        String trim = mEtBalance.getText().toString().trim();
        if (TextUtils.isEmpty(trim)) {
            trim = "0";
        } else {
            Double aDouble = Double.valueOf(trim);
            if (aDouble < 0.01)
                trim = "0.01";
        }
        AliPayBalanceDetailActivity.start(this, MoneyFormat.formatMoney(trim));
    }
}
